package com.mynetty;

import java.net.InetSocketAddress;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import com.mynetty.pool.NioSelectorRunnablePool;

/**
 * 启动函数
 * 
 * @author -琴兽-
 *
 */
public class Start {

	public static void main(String[] args) {
		// 初始化线程

		// 负责监听端口, 给worker分配任务
		ExecutorService boss = Executors.newCachedThreadPool();
		// 为客户端服务, 处理客户端读写
		ExecutorService workder = Executors.newCachedThreadPool();

		NioSelectorRunnablePool nioSelectorRunnablePool = new NioSelectorRunnablePool(
				boss, workder);

		// 获取服务类
		ServerBootstrap bootstrap = new ServerBootstrap(nioSelectorRunnablePool);

		// 绑定端口
		bootstrap.bind(new InetSocketAddress(10101));

		System.out.println("start");
	}

}
